package vue;

import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JRadioButton;
import javax.swing.ButtonGroup;
import javax.swing.border.TitledBorder;
import javax.swing.UIManager;
import javax.swing.JButton;

import modele.Commande;

import controleur.ModeDePaiementController;
import controleur.PasserCommandeController;

public class ModeDePaiement extends JPanel {
	private final ButtonGroup buttonGroupModeDePaiement = new ButtonGroup();
	private JButton btnContinuerModeDePaiment;
	private JRadioButton rdbtnParCheque ;
	private JRadioButton rdbtnParCarteBancaire;
	private JRadioButton rdbtnEnEspces;
	private Commande commande= new Commande();
	ModeDePaiementController mdpc;
	PasserCommandeController cmdctrl;
	public PasserCommandeController getCmdctrl() {
		return cmdctrl;
	}

	public void setCmdctrl(PasserCommandeController cmdctrl) {
		this.cmdctrl = cmdctrl;
	}

	public ModeDePaiementController getMdpc() {
		return mdpc;
	}

	public void setMdpc(ModeDePaiementController mdpc) {
		this.mdpc = mdpc;
	}

	public JRadioButton getRdbtnParCheque() {
		return rdbtnParCheque;
	}

	public void setRdbtnParCheque(JRadioButton rdbtnParCheque) {
		this.rdbtnParCheque = rdbtnParCheque;
	}

	public JRadioButton getRdbtnParCarteBancaire() {
		return rdbtnParCarteBancaire;
	}

	public void setRdbtnParCarteBancaire(JRadioButton rdbtnParCarteBancaire) {
		this.rdbtnParCarteBancaire = rdbtnParCarteBancaire;
	}

	public JRadioButton getRdbtnEnEspces() {
		return rdbtnEnEspces;
	}

	public void setRdbtnEnEspces(JRadioButton rdbtnEnEspces) {
		this.rdbtnEnEspces = rdbtnEnEspces;
	}

	public JRadioButton getRdbtnAutre() {
		return rdbtnAutre;
	}

	public void setRdbtnAutre(JRadioButton rdbtnAutre) {
		this.rdbtnAutre = rdbtnAutre;
	}

	private JRadioButton rdbtnAutre;
	

	public JButton getBtnContinuerModeDePaiment() {
		return btnContinuerModeDePaiment;
	}

	public void setBtnContinuerModeDePaiment(JButton btnContinuerModeDePaiment) {
		this.btnContinuerModeDePaiment = btnContinuerModeDePaiment;
	}

	public Commande getCommande() {
		return commande;
	}

	public void setCommande(Commande commande) {
		this.commande = commande;
		this.mdpc.setCommande(commande);
	}

	/**
	 * Create the panel.
	 */
	public ModeDePaiement() {
		setLayout(null);
		
		JPanel panel = new JPanel();
		panel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Modes de paiement", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		panel.setBounds(138, 67, 173, 155);
		add(panel);
		panel.setLayout(null);
		
		rdbtnParCheque = new JRadioButton("Par ch\u00E8que");
		rdbtnParCheque.setBounds(6, 16, 109, 23);
		panel.add(rdbtnParCheque);
		buttonGroupModeDePaiement.add(rdbtnParCheque);
		
		rdbtnParCarteBancaire = new JRadioButton("Par Carte Bancaire");
		rdbtnParCarteBancaire.setBounds(6, 45, 130, 23);
		panel.add(rdbtnParCarteBancaire);
		buttonGroupModeDePaiement.add(rdbtnParCarteBancaire);
		
		rdbtnEnEspces = new JRadioButton("En esp\u00E8ces / Tickets Restos");
		rdbtnEnEspces.setBounds(6, 75, 161, 23);
		panel.add(rdbtnEnEspces);
		buttonGroupModeDePaiement.add(rdbtnEnEspces);
		
		rdbtnAutre = new JRadioButton("Autre ...");
		rdbtnAutre.setBounds(6, 101, 109, 23);
		panel.add(rdbtnAutre);
		buttonGroupModeDePaiement.add(rdbtnAutre);
		
		JLabel lblNewLabel = new JLabel("Choisissez votre mode de paiement.");
		lblNewLabel.setBounds(121, 16, 173, 14);
		add(lblNewLabel);
		
		btnContinuerModeDePaiment = new JButton("Continuer");
		btnContinuerModeDePaiment.setBounds(331, 250, 89, 23);
		add(btnContinuerModeDePaiment);
		
		mdpc= new ModeDePaiementController(this,commande);
		System.out.println("0kconstruit 1");
	}
}
